//
//  QLBottomOptionsView.m
//  QLCustomCamera_Example
//
//  Created by 李强 on 2020/8/29.
//  Copyright © 2020 李强LiQ. All rights reserved.
//

#import "QLBottomOptionsView.h"
#import "QLRecordView.h"
#import "QLRecordManager.h"
#import "UIImage+QLImage.h"
#import <Masonry/Masonry.h>


@interface QLBottomOptionsView ()

@property (nonatomic,strong)UIButton *cancleBtn;//取消
@property (nonatomic,strong)UIButton *filterBtn;//滤镜
@property (nonatomic,strong)UIButton *selectedBtn;//选择

@property(nonatomic,strong)UIButton *editBtn;


@end

@implementation QLBottomOptionsView

-(instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame]) {
        [self configureView];
    }
    return self;
}

-(void)configureView
{
    //保存按钮
    UIImage *saveImg = [UIImage getBundleImageWithName:@"record_save" className:NSStringFromClass([self class])];
    _selectedBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _selectedBtn.frame = CGRectMake((self.frame.size.width-saveImg.size.width)/2, (self.frame.size.height-saveImg.size.height)/2, saveImg.size.width, saveImg.size.height);
    [_selectedBtn setImage:saveImg forState:UIControlStateNormal];
    [_selectedBtn addTarget:self action:@selector(selected) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_selectedBtn];
    
    //返回
    _cancleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    UIImage *img1 = [UIImage getBundleImageWithName:@"record_cancle" className:NSStringFromClass([self class])];
    [_cancleBtn setImage:img1 forState:UIControlStateNormal];
    [_cancleBtn addTarget:self action:@selector(cancle) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:_cancleBtn];
    [self.cancleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(40);
        make.centerY.equalTo(self);
    }];
    
//    //编辑
//    _editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    [_editBtn setTitle:@"编辑" forState:UIControlStateNormal];
//    [_editBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
//    _editBtn.titleLabel.font = [UIFont systemFontOfSize:14];
//    [_editBtn addTarget:self action:@selector(editClick) forControlEvents:UIControlEventTouchUpInside];
//    [self addSubview:_editBtn];
//    [self.editBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.equalTo(self).offset(-40);
//        make.centerY.equalTo(self);
//    }];
}
//删除
-(void)cancle
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(selectedClick)]) {
        [self.delegate cancleClick];
    }
}
//保存
-(void)selected
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(selectedClick)]) {
        [self.delegate selectedClick];
    }
}

//编辑
-(void)editClick{
    if (self.delegate && [self.delegate respondsToSelector:@selector(pushEditPage)]) {
        [self.delegate pushEditPage];
    }
}

-(void)setHidden:(BOOL)hidden
{
    [super setHidden:hidden];
    _filterBtn.hidden = [QLRecordManager shareManager].recordParam.getCurrentMode == videoMode ? YES : NO;
}


@end








































